core: Only do devino scan on commit (speeds up pull)
authorColin Walters <walters@verbum.org>
Fri, 5 Oct 2012 21:12:39 +0000 (17:12 -0400)
committerColin Walters <walters@verbum.org>
Fri, 5 Oct 2012 21:12:39 +0000 (17:12 -0400)
When fetching data remotely, there's no point to the devino scan
because we're not going to be committing local files.

Only do it for "commit".

src/libostree/ostree-repo.c
src/libostree/ostree-repo.h
src/ostree/ostree-pull.c
src/ostree/ot-builtin-commit.c
src/ostree/ot-builtin-pull-local.c

index ac3a3dc544352c3f916db4ecc9fa180416281208..4081b0b686378c18809c5a6b3724865f8e95e93f 100644 (file)
@@ -1276,6 +1276,7 @@ devino_cache_lookup (OstreeRepo           *self,
 
 gboolean
 ostree_repo_prepare_transaction (OstreeRepo     *self,
+                                 gboolean        enable_commit_hardlink_scan,
                                  GCancellable   *cancellable,
                                  GError        **error)
 {
@@ -1285,13 +1286,14 @@ ostree_repo_prepare_transaction (OstreeRepo     *self,
 
   self->in_transaction = TRUE;
 
-  if (!self->loose_object_devino_hash)
+  if (enable_commit_hardlink_scan)
     {
-      self->loose_object_devino_hash = g_hash_table_new_full (devino_hash, devino_equal, g_free, g_free);
+      if (!self->loose_object_devino_hash)
+        self->loose_object_devino_hash = g_hash_table_new_full (devino_hash, devino_equal, g_free, g_free);
+      g_hash_table_remove_all (self->loose_object_devino_hash);
+      if (!scan_loose_devino (self, self->loose_object_devino_hash, cancellable, error))
+        goto out;
     }
-  g_hash_table_remove_all (self->loose_object_devino_hash);
-  if (!scan_loose_devino (self, self->loose_object_devino_hash, cancellable, error))
-    goto out;
 
   ret = TRUE;
  out:
index 2f7ac7a81a2c266b96dcf1fb700bd5859c85d323..0ed4c2bf79f4ebcb49fd8efa4afd0aa35b84d619 100644 (file)
@@ -77,6 +77,7 @@ GFile *       ostree_repo_get_file_object_path (OstreeRepo   *self,
                                                 const char   *object);
 
 gboolean      ostree_repo_prepare_transaction (OstreeRepo     *self,
+                                               gboolean        enable_commit_hardlink_scan,
                                                GCancellable   *cancellable,
                                                GError        **error);
 
index ccbb00320871f909c9a038d008bef59aa90f6024..a618ee9904bee860558125d662704a5d07e89dc9 100644 (file)
@@ -1333,7 +1333,7 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
         }
     }
 
-  if (!ostree_repo_prepare_transaction (pull_data->repo, NULL, error))
+  if (!ostree_repo_prepare_transaction (pull_data->repo, FALSE, NULL, error))
     goto out;
 
   pull_data->metadata_scan_active = TRUE;
index 730e32183256dd1baf44086aa8a736018135c0da..96a41ebbc9dff0848656343d3a52b395212e9c08 100644 (file)
@@ -351,7 +351,7 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error)
         goto out;
     }
 
-  if (!ostree_repo_prepare_transaction (repo, cancellable, error))
+  if (!ostree_repo_prepare_transaction (repo, TRUE, cancellable, error))
     goto out;
 
   in_transaction = TRUE;
index 8b7304db3b5e7cc7af2c578dc9768b00fc2fcc2c..94f0b8801cdf93d23632b0f9e7316057aec0de65 100644 (file)
@@ -196,7 +196,7 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
 
   g_print ("%u objects to copy\n", g_hash_table_size (objects_to_copy));
 
-  if (!ostree_repo_prepare_transaction (data.dest_repo, cancellable, error))
+  if (!ostree_repo_prepare_transaction (data.dest_repo, FALSE, cancellable, error))
     goto out;
   
   g_hash_table_iter_init (&hash_iter, objects_to_copy);